export default{
				namespaced:true,
				state:{ 
						address: JSON.parse(uni.getStorageSync('address') || '{}') ,
						token:uni.getStorageSync('token') || '',
						user:JSON.parse(uni.getStorageSync('user') || '{}'),
						redirectInfo:'',//当是购物车页面登录需要此变量 登录后跳转回购物车页面
				},
				mutations:{
					setRedirectInfo(state,url){
								state.redirectInfo = url
					},
						setUser(state,user){
									state.user = JSON.parse(JSON.stringify(user))
									uni.setStorageSync('user',JSON.stringify(state.user))
						},
						loginOut(state){
									// state.address = {}
									state.token = ''
									state.user = {}
									state.redirectInfo = ''
									uni.removeStorageSync('user')
									uni.removeStorageSync('token')
									// uni.removeStorageSync('address')
						},
						setToken(state,token){
									state.token = token
									uni.setStorageSync('token',state.token)
						},
						setAddress(state,obj){
									state.address = JSON.parse(JSON.stringify(obj)) 
									uni.setStorageSync('address',JSON.stringify(state.address))
						}
				},
				
				getters:{
							addStr(state){
									if(!state.address.provinceName) return ''
									//拼接
									return state.address.provinceName + state.address.cityName + state.address.countyName + state.address.detailInfo
							}
				}
				
}